package secondBrush.doubles.summary;

import com.sun.source.tree.WhileLoopTree;
import secondBrush.doubles.E08Leetcode19;
import secondBrush.list.Node;

public class E14Leetcode0207 {
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode A = headA;
        ListNode B = headB;
        while (A != B) {
            A = A != null ? A.next : headB;
            B = B != null ? B.next : headA;
        }

        return A;


    }


      public class ListNode {
     int val;
     ListNode next;
     ListNode(int x) {
         val = x;
         next = null;
     }
 }
}
